#include <sys/eventfd.h>
#include <unistd.h>
#include <iostream>
int main(){
    // int eventfd(int interval, int flags);
    // int efd = eventfd(0, 0); // up to kernel version Linux 2.6.26 the flags arg is unused
    int efd = eventfd(0, EFD_NONBLOCK | EFD_CLOEXEC); 

    uint64_t val = 10;
    write(efd, &val, sizeof(val));
    write(efd, &val, sizeof(val));
    write(efd, &val, sizeof(val));


    uint64_t ret1 = 0;
    uint64_t ret2 = 0;
    read(efd, &ret1, sizeof(val));
    read(efd, &ret2, sizeof(val));

    std::cout << ret1 << std::endl;
    std::cout << ret2 << std::endl;
    return 0;
}